﻿using System;
using System.IO;

namespace _01.PrintOddLines
{
    class PrintOddLines
    {
        static void Main()
        {
            //Create text file with 20 lines
            StreamWriter streamWriter = new StreamWriter("NumberedLines.txt");
            using (streamWriter)
            {
                for (int i = 1; i <= 20; i++)
                {
                    streamWriter.WriteLine(i);
                }
            }

            //Reading the file and printing the odd lines
            StreamReader streamReader = new StreamReader("NumberedLines.txt");
            using (streamReader)
            {
                string line = streamReader.ReadLine();
                int lineCount = 0;
                while (line != null)
                {
                    lineCount++;
                    if (lineCount%2 == 1)
                    {
                        Console.WriteLine(line);
                    }
                    line = streamReader.ReadLine();



                }
            }
        }
    }
}
